﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.fminutes.vinciLib.utils {
    import flash.utils.*;

    public class CRC32 {

        private static var crcTable:Array = makeCrcTable();

        private var crc:uint;

        private static function makeCrcTable():Array{
            var _local3:uint;
            var _local4:int;
            var _local1:Array = new Array(0x0100);
            var _local2:int;
            while (_local2 < 0x0100) {
                _local3 = _local2;
                _local4 = 8;
                while (--_local4 >= 0) {
                    if ((_local3 & 1) != 0){
                        _local3 = (3988292384 ^ (_local3 >>> 1));
                    } else {
                        _local3 = (_local3 >>> 1);
                    };
                };
                _local1[_local2] = _local3;
                _local2++;
            };
            return (_local1);
        }

        public function getValue():uint{
            return ((this.crc & 4294967295));
        }
        public function reset():void{
            this.crc = 0;
        }
        public function update(_arg1:ByteArray):void{
            var _local2:uint;
            var _local3:uint = _arg1.length;
            var _local4:uint = ~(this.crc);
            while (--_local3 >= 0) {
                var _temp1 = _local2;
                _local2 = (_local2 + 1);
                _local4 = (crcTable[((_local4 ^ _arg1[_temp1]) & 0xFF)] ^ (_local4 >>> 8));
            };
            this.crc = ~(_local4);
        }

    }
}//package com.fminutes.vinciLib.utils 
